package com.concurrent.frame.util;

import com.concurrent.frame.pojo.TaskResult;
import com.concurrent.frame.pojo.TaskResultType;

public class Assert {
    public static void isNotNULL(Object object,String msg){
        if (object==null){
            throw new RuntimeException(object+"msg");
        }
    }
    public static TaskResult isTaskResult(TaskResult result){
        if (result==null){
            result = new TaskResult(TaskResultType.Exception,null,"Result is null");
        }
        if (result.getResultType()==null){
            if (result.getReason()==null){
                result = new TaskResult(TaskResultType.Exception,null,"reason is null");
            }else{
                result = new TaskResult(TaskResultType.Exception,null,"result is null,but reason is ["+result.getReason()+"] ");
            }
        }
        return  result;
    }

}
